package Library.operation;

import Library.Book;
import Library.BookList;

import java.util.Scanner;

public class FindOperation implements IOperation{

    @Override
    public void work(BookList bookList) {
        System.out.println("查找书籍");
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入要查找书籍");
        String name = scanner.next();
        for(int i=0;i < bookList.getSize() -1;i++){
            Book book = bookList.getBook(i);
            if(book.getName().equals(name)){
                System.out.println(book);
            } else{
                System.out.println("找不到");
                break;
            }

        }
        System.out.println("查找书籍完成");
    }
}
